import { get } from '@/utils/http'

/* export const getFilmsApi = (page = 1) =>
  get(`/api/v1/getNowPlayingFilmList?cityId=110100&pageNum=${page}&pageSize=10`)
 */

export const getFilmsApi = async (page = 1) => {
  let result = { films: [], total: 0 }
  let ret = await get(
    `/api/v1/getNowPlayingFilmList?cityId=110100&pageNum=${page}&pageSize=10`
  )
  if (ret.status === 0) {
    // result = ret.data.films.map(({ filmId, name }) => ({ id: filmId, name }))
    result = {
      films: ret.data.films,
      total: ret.data.total
    }
  }
  return result
}
